﻿Imports TodoMicroSolutionPackV1.bl.bo
Namespace bl
    Public Delegate Function simpleRuleDelegate() As Boolean
    Public Class SimpleRule
        Inherits Rule

        Private _ruleDelegate As simpleRuleDelegate

        Public Sub New(ByVal propertyName As String, ByVal brokenDescription As String, ByVal ruleDelegate As simpleRuleDelegate)
            MyBase.New(propertyName, brokenDescription)
            Me._ruleDelegate = ruleDelegate
        End Sub

        Protected Overridable Property RuleDelegate As simpleRuleDelegate
            Get
                Return _ruleDelegate
            End Get
            Set(ByVal value As simpleRuleDelegate)
                _ruleDelegate = value
            End Set
        End Property

        Public Overrides Function validateRule(ByRef businessObject As genericBusinessObject) As Boolean
            Return RuleDelegate.Invoke
        End Function

    End Class
End Namespace

